using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.Xna.Framework;

namespace IsolatedPerformanceTests
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            const string teststr = "aaaaa";
            string arg=teststr.Substring(teststr.IndexOf(' '));
            Console.WriteLine(arg);

            return;
            var perf = new PerfMeter("Struct", true);
            testing.TestMethod1();
            perf.Stop();
            Console.WriteLine(perf);


            perf.TestName = "Ref";
            perf.Start();
            testing.TestMethod2();
            perf.Stop();
            Console.WriteLine(perf);

            perf.TestName = "Struct";
            perf.Start();
            testing.TestMethod1();
            perf.Stop();
            Console.WriteLine(perf);

            perf.TestName = "Ref";
            perf.Start();
            testing.TestMethod2();
            perf.Stop();
            Console.WriteLine(perf);

            Console.ReadKey();

            //using (Game1 game = new Game1())
            //{
            //    game.Run();
            //}
        }
        private static readonly TestingMethods testing = new TestingMethods();


    }

    class TestingMethods
    {
        private struct MyStruct
        {
            public Vector3 v;
        }
        private Matrix Test1(MyStruct v)
        {
            return Matrix.CreateFromAxisAngle(v.v, 90);
        }
        private Matrix Test1(ref MyStruct v)
        {
            return Matrix.CreateFromAxisAngle(v.v, 90);
        }

        public void TestMethod1()
        {
            for (int i = 0; i < times; i++)
            {
                MyStruct v = new MyStruct { v = new Vector3(i) };
                Test1(v);
            }
        }
        public void TestMethod2()
        {
            for (int i = 0; i < times; i++)
            {
                MyStruct v = new MyStruct { v = new Vector3(i) };
                Test1(ref v);
            }
        }

        const int times = 1000000;
    }
}

